home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ShareWare OnLine 2
/
ShareWare OnLine Volume 2 (CMS Software)(1993).iso
/
prog
/
spx10.zip
/
SPX_DOC.ZIP
/
SPX_T3D.DOC
< prev
next >
Wrap
Text File
|
1993-05-05
|
3KB
|
69 lines
{ SPX Library Version 1.0 Copyright 1993 Scott D. Ramsay }
The SPX_T3D is the basic 3D and angle unit. It contains
a sine/cosine table as well as simple rotation functions in 2D and 3D.
This unit is very simpilfied to keep the math from you ;)
GLOBAL VARIABLES:
xc,yc: Origin point (0,0,0) for 3D routines on the screen
Default: xc=160 yv=100 (center of VGA screen)
xv,yv,zv: Viewer's position. Location point of your eye
Default: xv=0 yv=-10 zv=150
sx,sy,sz: Scale factors. Values to scale each 3D plot.
Default: sx=1 sy=1 sz=1
sine,cosine: Sine and Cosine look up tables from 0 to 255.
sine[i] := sin(2*3.141592653/256*i)*256;
cosine[i] := cos(2*3.141592653/256*i)*256;
───────────────────────────────────────────────────────────────────────────
procedure setpoints(xx,yy,zz:longint; var xd,yd : integer);
Converts a 3D point to a 2D screen point.
XX,YY,ZZ: (x,y,z) 3D point;
XD,YD: converted (x,y) 2D point
XD,YD can be affected by SX, SY, SZ, XV, YV, ZV, XC, YC
───────────────────────────────────────────────────────────────────────────
procedure pset3d(xx,yy,zz:integer;n:byte);
Draw a point.
XX,YY,ZZ: (x,y,z) 3D point;
N: Color of point
───────────────────────────────────────────────────────────────────────────
procedure line3d(x1,y1,z1,x2,y2,z2:integer;n:byte;clip:boolean);
Draw a line. Clips the line according to
WinMinX, WinMinY, WinMaxX, WinMaxY.
X1,Y1,Z1: Coordinate 1 of line;
X2,Y2,Z2: Coordinate 2 of line;
N: Color of line
CLIP: If set to TRUE, the line will be clipped according to
WinMinX, WinMinY, WinMaxX, WinMaxY.
NOTE: CLIP=FALSE is faster.
───────────────────────────────────────────────────────────────────────────
procedure rotate256xy(var x,y:integer;angle:byte);
Rotates a 2D point (x,y) about the origin (0,0).
X,Y: Point to rotate;
ANGLE: Amount to rotate. Legal values: 0..255
───────────────────────────────────────────────────────────────────────────
procedure rotate256xyz(var x,y,z:integer;xa,ya,za:byte);
Rotates a 3D point (x,y,z) about the origin (0,0,0).
X,Y,Z: Point to rotate;
XA: Amount to rotate on the x-axis. Legal values: 0..255;
YA: Amount to rotate on the y-axis. Legal values: 0..255;
ZA: Amount to rotate on the z-axis. Legal values: 0..255
───────────────────────────────────────────────────────────────────────────